package com.qf.controller;

import com.qf.pojo.Goods;
import org.springframework.web.bind.annotation.*;

/**
 * author:z
 * time:2021/12/18 10:13
 * description:
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @GetMapping("/index")
    public String index(){
//        System.out.println(1/0);
        return "获取商品: 9001";
    }

    @GetMapping("/findById/{goodsId}")
    public Goods findById(@PathVariable("goodsId") Integer id){
        return new Goods(id, "手办", System.currentTimeMillis());
    }

    @GetMapping("/findById")
    public Goods findById2(Integer id){
        System.out.println(1/id);
        return new Goods(id, "手办", 500);
    }

    @GetMapping("/save")
    public String save( Goods goods){
        System.out.println("goods=============保存商品对象：" + goods);
        return "success";
    }
}
